import http from '@/utils/request'

// 轮播图管理列表
function bannerListReq(category, per = 1, page = 10) {
  return http({
    method: 'get',
    url: '/api/v1/admin/banner',
    params: { category, per, page },
  })
}

// 新增轮播图
function bannerAddReq(category, name, link, url, desc, coverImage) {
  return http({
    method: 'post',
    url: '/api/v1/admin/banner',
    data: {
      category,
      name,
      link,
      url,
      desc,
      coverImage,
    },
  })
}

// 修改轮播图
function bannerModifyReq(id, category,name, link, url, desc, coverImage) {
  return http({
    method: 'put',
    url: '/api/v1/admin/banner/'+id,
    params: {
      category,
      name,
      link,
      url,
      desc,
      coverImage,
    },
  })
}

// 删除轮播图
function bannerDelReq(id) {
  return http({
    method: 'delete',
    url: '/api/v1/admin/banner/'+id,
  })
}

export { bannerListReq, bannerAddReq, bannerModifyReq, bannerDelReq }
